const tokenKey = 'token';
const uidKey = 'mallFrontUserid';

export const getToken = () => {
  const token= localStorage.getItem(tokenKey);
  return token;
};

export const setToken = (token) => {
  localStorage.setItem(tokenKey, token);
};
export const removeToken = () => {
  localStorage.removeItem(tokenKey);
};
export const getUid = () => {
  const token = localStorage.getItem(uidKey);
  return token;
};
export const setUid = (uid) => {
  localStorage.setItem(uidKey, uid);
};
export const removeUid = () => {
  localStorage.removeItem(uidKey);
};

// 封装一个判断是否登录的函数
export const isLogin = () => {
  const token = getToken();
  if (token) return true;
  else return false;
};
